﻿using PoemGame.Domain.Seedwork;

namespace PoemGame.Domain.PlayerAggregate
{
    public class Player : AggregateRoot
    {
        public string UserName { get; private set; }
        public string NickName { get; private set; }
        public int Score { get; private set; }

        /// <summary>
        /// 持久化框架使用
        /// </summary>
        private Player()
        { }

        public Player(Guid id, string userName, string nickName, int score)
        {
            Id = id;
            UserName = userName;
            NickName = nickName;
            Score = score;
        }

        public void IncreaseScore(int number)
        {
            Score += number;
        }

        public void DecreaseScore(int number)
        {
            Score -= number;
        }

        public void ChangeNickName(string newNickName)
        {
            NickName = newNickName;
        }

        public void DoubleScore()
        {
            Score *= 2;
        }
    }
}